home *** CD-ROM | disk | FTP | other *** search
- {----------------------------------------------------------------------------}
- { }
- { Slideshow type of display for Color Graphics Adapter pictures in medium }
- { resolution mode. Compatible with pictures BSAVEd with BASICA. Written in }
- { Turbo Pascal version 3.0 . Usage is: "demo list" where 'demo' is the name }
- { of the .COM file created by compiling this code and 'list' is an ASCII }
- { file containing the names of the pictures to be loaded and displayed. It }
- { loads pictures much faster than BASICA. Loads pictures listed in 'list' }
- { until end of list. 'List' specifies 'filename', 'duration' of display in }
- { milliseconds ( 1000 -> 1 sec. ), and the 'palette' number ( 0 to 3 ) on }
- { each line. Must be listed in pure ASCII. }
- { Typing "demo makelist" will activate the list file making utility, }
- { Makelist.Com, which must be on the default drive. This will allow one }
- { to create a list file for input to Demo.Com. At the end of makelist the }
- { user is asked if (s)he wants to return to demo. A "y" response will run }
- { demo again. Again, Demo.Com must be on the same disk in the default drive }
- { or program will not work. Makelist can be run as a stand alone program }
- { also. After one creates a list file, control can be transferred to demo }
- { as usual. At all times when transferring control to demo the name of the }
- { newly created list file is passed to demo on the command line so user will }
- { not have to reenter it. }
- { The source code included in this package for those who are interested. }
- { Programming is too much fun to keep to oneself so use these techniques in }
- { any manner you see fit in your own programs but I reserve the right to }
- { reuse these and any outgrowths of these programs in the future for fun or }
- { profit. }
- { }
- { }
- { If you find this useful and have it in your heart to contribute to the }
- { cause of affordable software please send $10.00 to the following: }
- { }
- { Joe Halbleib }
- { 36229 Magellan Dr. }
- { Fremont, CA. 94536 }
- { }
- { Contributors may request special versions of program for an extra cost }
- { to be negotiated at time of request. }
- { }
- {----------------------------------------------------------------------------}
-
-
-
-
-
- {$C-} { disable control char interpretation and thus user interupt }
-
- program Demo;
-
- type
-
- PictureRec = record
- screenful : array[1..16380] of byte { actual bytes shown on }
- end; { screen in med res }
-
- BsaveRec = record
- BsaveJunk : array[1..7] of byte; { <- not sure what these 7 }
- Screen : PictureRec { bytes are for but might }
- end; { be location in memory to }
- { BLOAD in BASICA or color }
- { palette or both! }
-
- filenametype = string[127];
- linetype = string[80];
-
- const
- Title = 'DEMO PICTURE SLIDESHOW';
- inputquestion = 'Input file to use: ';
- byebye = 'Program Demo Terminated.';
- confirmanswer = 'Using input file: ';
- booboo = 'Input file does not exist!';
- badpicture = 'Cannot locate picture file: ';
- ExecError = 'Cannot locate list maker module: ';
- ExecMessage = 'Executing Makelist.Com';
-
- var
- listfile : text; { input file variable }
- infile : file of BsaveRec; { files which contain pictures }
- execfile : file;
- TempPic : BsaveRec; { construct with which BSAVE stores pictures }
- filename : filenametype;
- display : PictureRec absolute $B800:$0000; { start of CGA regen }
- ch : char; { buffer memory }
- i,time,
- PaletteNo : integer;
-
- function center(str : linetype) : integer;
- begin
- center := 39-round(length(str)/2)
- end;
-
- procedure CursorOff; { directly manipulates the CGA (color graphics card) }
- begin
- port[$3d4]:=10; { 6845 crt controller ind reg;points to reg to rec }
- port[$3d5]:=8; { data which is output to reg here;strt scan ln=8 }
- port[$3d4]:=11; { index to reg for cursor stop scan ln }
- port[$3d5]:=7; { stop scan line=7 }
- end;
-
- procedure CursorOn; { directly manipulates the CGA (color graphics card) }
- begin
- port[$3d4]:=10;
- port[$3d5]:=6; { start scan line = 6 ( normal ) }
- port[$3d4]:=11;
- port[$3d5]:=7; { stop scan line = 7 ( normal ) }
- end;
-
- procedure FixScreen; { prepare to end program }
- begin
- textmode(C80); { Reset color-text mode }
- textcolor(14); { I like bright yellow }
- textbackground(0); { and black background }
- clrscr;
- gotoxy(Center(byebye),12);
- cursoroff;
- write(byebye);
- delay(1000);
- gotoxy(1,24);
- cursoron;
- halt { End program }
- end;
-
- procedure AbortCheck;
- begin
- for i := 1 to 300 do { check for <ctrl>-c to abort program }
- if keypressed then { check alot! }
- begin
- read(kbd,ch);
- if ch = #3 then fixscreen
- end
- end;
-
- function Exist(filename: filenametype) : boolean; { check if a file exists }
- var { before trying to read it }
- tempfile : file;
- dummy : integer;
-
- begin
- assign(tempfile,filename);
- {$I-} { disable automatic generation of I/O checking code }
- reset(tempfile); { attempt to open file }
- Exist:=(IOresult=0); { standard function IOresult give 0 if no error }
- close(tempfile); { just in case the file exists, it must be closed or }
- dummy := IOresult; { end up with too many open files and prog. will abort }
- {$I+} { re-enable automatic generation of I/O checking code }
- end;
-
- begin { Demo }
-
- clrscr;
- gotoxy(center(Title),12);
- cursoroff;
- write(Title);
- delay(2500);
-
- filename := paramstr(1);
- for i := 1 to length(filename) do filename[i] := upcase(filename[i]);
-
- if filename = 'MAKELIST' then
- begin
- if Exist('makelist.com') then
- begin
- clrscr;
- gotoxy(Center(ExecMessage),12);
- write(ExecMessage);
- delay(1000);
- assign(execfile,'makelist.com');
- execute(execfile)
- end
- else
- begin
- clrscr;
- gotoxy(Center(ExecError+'Makelist.Com'),12);
- cursoroff;
- write(ExecError+'Makelist.Com!');
- delay(1000)
- end
- end;
-
- if paramstr(1) <> '' then
- filename := paramstr(1) { get name of input file from command line }
- else
- begin
- clrscr; { or ask what file to use }
- gotoxy(Center(inputquestion),12);
- write(inputquestion);
- read(filename)
- end;
- if filename = '' then fixscreen; { if still no filename specified then end }
-
- if Exist(filename) then
- begin
- assign(listfile,filename);
- reset(listfile)
- end
- else
- begin
- clrscr;
- gotoxy(Center(booboo+filename),12);
- write(booboo);
- delay(2000);
- fixscreen
- end;
-
- clrscr;
- gotoxy(Center(confirmanswer+filename),12);
- write(confirmanswer,filename); { tell user what filename (s)he chose }
- cursoroff; { turn off cursor forn esthetic reasons }
- delay(2000);
- graphcolormode;
-
- repeat
-
- AbortCheck;
- filename := ''; { get variable length filenames from 'list' }
- read(listfile,ch);
- while ch = #32 read(listfile,ch); { ignore leading spaces }
- while ch <> #32 do
- begin
- AbortCheck;
- filename := filename + ch;
- read(listfile,ch)
- end;
-
- readln(listfile,time,PaletteNo); { get duration and palette number }
-
- if filename = '' then fixscreen; { if no filename then abort }
-
- if Exist(filename+'.PIC') then
- begin
- assign(infile,filename+'.pic'); { assume .PIC extension }
- reset(infile);
- read(infile,TempPic); { read entire Bsaverec }
- abortcheck;
- graphcolormode;
- palette(paletteNo);
- display := TempPic.Screen; { throw away the 7 bytes (BsaveJunk) }
- delay(time);
- close(infile); { don't forget to close the file or }
- AbortCheck; { will end up with too many open files }
- end
-
- else
- begin
- textmode(c80);
- clrscr;
- gotoxy(Center(badpicture+filename+'.Pic'),12);
- cursoroff;
- write(badpicture+filename+'.Pic');
- delay(1000)
- end;
- AbortCheck;
-
- until eof(listfile);
-
- fixscreen
-
- end. { Demo }